package com.csun.dsms.service.impl;

import com.csun.dsms.comment.core.support.BaseService;
import com.csun.dsms.mapper.YsSettingMapper;
import com.csun.dsms.mapper.YsSignRecordMapper;
import com.csun.dsms.model.domain.YsSetting;
import com.csun.dsms.model.domain.YsSignRecord;
import com.csun.dsms.model.dto.ys.YsQueryDto;
import com.csun.dsms.service.YsSettingService;
import com.csun.dsms.service.YsSignRecordService;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class YsSignRecordServiceImpl extends BaseService<YsSignRecord> implements YsSignRecordService {

    @Resource
    private YsSignRecordMapper ysSignRecordMapper;

    @Override
    public Integer addRecord(YsSignRecord ysSignRecord) {
        return ysSignRecordMapper.insertSelective(ysSignRecord);
    }

    @Override
    public List<YsSignRecord> queryListWithPage(YsQueryDto ysQueryDto) {
        PageHelper.startPage(ysQueryDto.getPageNum(),ysQueryDto.getPageSize());
        if (ysQueryDto.getTeacherId()==null){
            return ysSignRecordMapper.queryListWithPage(ysQueryDto);
        }else {
            return ysSignRecordMapper.queryListByTeacherId(ysQueryDto);
        }
    }
}
